package com.laotou99.wmsjjj.wmsjjj;

import static org.junit.Assert.assertEquals;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.laotou99.wmsjjj.wmsjjj.service.BaseInfoService;

@RunWith(SpringRunner.class)
@SpringBootTest
public class WmsjjjStoreKeyTest6 {

	@Autowired
	BaseInfoService baseInfoService;
	

	@Test
	public void contextLoads() {
		System.out.println("first load");
	}
	
	@Before
	public void before() {
		System.out.println("before");
	}
	
	@After
	public void after() {
		System.out.println("after()");
	}
	
	@Test
	public void showAll() {
		System.out.println("showAll()");
		JSONObject jo1 = new JSONObject();
		try {
			String listStoreKey = baseInfoService.listStoreKey(jo1);
			System.out.println("showAll() listStoreKey-=>"
				+JSON.toJSONString(listStoreKey));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		assertEquals(1+1, 2);
	}
	

	@Test
	public void addNew() {
		System.out.println("addNew()");

		JSONObject jo1 = new JSONObject();
		jo1.put("storeKey", "eeee");
		jo1.put("storeName", "ccccc");
		jo1.put("storeNO", "bbbbb");
		jo1.put("address", "aaaaa");
		
		try {
			String result = baseInfoService.addNew(jo1);
			System.out.println("addNew() result-=>"+result);
		} catch (Exception e) { 
			e.printStackTrace();
		}
		
		assertEquals(1+1, 2);
	}
	
	@Test
	public void update() {

		JSONObject jo1 = new JSONObject();
		jo1.put("storeKey", "4eeee");
		jo1.put("storeName", "3ccccc");
		jo1.put("storeNO", "1bbbbb");
		jo1.put("address", "2aaaaa");
		jo1.put("id", 227);
		jo1.put("address", 1741271788583L);
		
		String result;
		try {
			result = baseInfoService.update(jo1);
			System.out.println("update() result-=>"+result); 
		} catch (Exception e) { 
			e.printStackTrace();
		}
		assertEquals(1+1, 2);
	}
	
	@Test
	public void selectById() { 

		JSONObject jo1 = new JSONObject();
		jo1.put("id", 161);
		String result;
		try {
			result = baseInfoService.selectById(jo1);
			System.out.println("selectById() result-=>"+result); 
		} catch (Exception e) { 
			e.printStackTrace();
		} 
		assertEquals(1+1, 2);
	}
	
	@Test
	public void delete() {

		JSONObject jo1 = new JSONObject();
		jo1.put("id", 161);
		try {
			String result = baseInfoService.delete(jo1);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		assertEquals(1+1, 2);
	}
	
	@Test
	public void addNewSKU() {

		JSONObject jo1 = new JSONObject();
		jo1.put("skuId", "99");
		jo1.put("storekey", "AAA");
		jo1.put("skuNum", "1");
		jo1.put("skuCN", "测试111");
		jo1.put("skuEN", "test111");
		jo1.put("legalUnit", "22");
		jo1.put("moq", "33");
		jo1.put("skuVolNum", "55");
		try {
			String result = baseInfoService.addNewSKU(jo1);
			System.out.println("addNewSKU() result-=>"+result); 
		} catch (Exception e) {
			e.printStackTrace();
		}

		assertEquals(1+1, 2);
	}
	
	@Test
	public void updateSKU() {
		JSONObject jo1 = new JSONObject();
		jo1.put("id", 8);
		jo1.put("skuId", "fa99");
		jo1.put("storekey", "fae");
		jo1.put("skuNum", "4");
		jo1.put("skuCN", "测试舱菜市场上厕所");
		jo1.put("skuEN", "test132sdz11");
		jo1.put("legalUnit", "31");
		jo1.put("moq", "44");
		jo1.put("skuVolNum", "515");
		jo1.put("remark1", "abcdefg");
		
		try {
			String result = baseInfoService.updateSKU(jo1);
			System.out.println("updateSKU() result-=>"+result); 
		} catch (Exception e) { 
			e.printStackTrace();
		} 
		
		assertEquals(1+1, 2);
	}
	
	@Test
	public void deleteSKU() {
		JSONObject jo1 = new JSONObject();
		jo1.put("id", 8);
		
		try {
			String result = baseInfoService.deleteSKU(jo1);
			System.out.println("deleteSKU() result-=>"+result); 
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		assertEquals(1+1, 2);
	}
	
	@Test
	public void selectSKUById() {
		JSONObject jo1 = new JSONObject();
		jo1.put("id", 41);
		
		try {
			String result = baseInfoService.selectSKUById(jo1);
			System.out.println("selectSKUById() result-=>"+result); 
		} catch (Exception e) { 
			e.printStackTrace();
		} 
	}
	
	
}
